package com.cl.unipay4j.demo.example;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * 通用请求返回封装Bean
 *
 * @Author: kfc
 * @Description: <br/>
 * Date:Create in 2019/7/24 10:27
 * @Modified By:
 */
@Accessors(chain = true)
@NoArgsConstructor
@Data
@ToString
public class R<T> {
    private int code;
    private int subCode;
    private String msg;
    private T data;

    public R(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public R(int code, int subCode, String msg) {
        this.code = code;
        this.subCode = subCode;
        this.msg = msg;
    }

    @JsonIgnore
    public boolean isSuccess(){
        return 200 == this.code;
    }
}
